package com.mo.ld.activity.interactive

import android.graphics.Color
import com.mo.lib.ui.activity.BaseRvActivity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mo.ld.R
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX
import androidx.fragment.app.FragmentActivity
import android.widget.TextView
import com.dylanc.longan.activity
import com.gyf.immersionbar.ImmersionBar
import com.mo.lib.utils.setClick

/**
 * @ author：mo
 * @ data：2021/9/23:10:23
 * @ 功能：
 */
class StatusBarActivity : BaseRvActivity<String>() {
    private val activityList: MutableList<String> = mutableListOf("UltimateBarX:侵入状态栏","UltimateBarX:不侵入状态栏",
        "UltimateBarX:状态栏字体:灰色","UltimateBarX:状态栏字体:白色","UltimateBarX:颜色填充","UltimateBarX:图片填充"
        ,"ImmersionBar:透明状态栏","ImmersionBar:状态栏字体:灰色(默认透明侵入了)","ImmersionBar:状态栏字体:白色(默认透明侵入了)")
//        private get() {
//            val list: MutableList<String> = ArrayList()
//            list.add("UltimateBarX:侵入状态栏")
//            list.add("UltimateBarX:不侵入状态栏")
//            list.add("UltimateBarX:状态栏字体:灰色")
//            list.add("UltimateBarX:状态栏字体:白色")
//            list.add("UltimateBarX:颜色填充")
//            list.add("UltimateBarX:图片填充")
//            list.add("ImmersionBar:透明状态栏")
//            list.add("ImmersionBar:状态栏字体:灰色(默认透明侵入了)")
//            list.add("ImmersionBar:状态栏字体:白色(默认透明侵入了)")
//            return list
//        }

    override fun creatAdaper(): BaseQuickAdapter<String, BaseViewHolder> {
        return object : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_main,activityList) {
             override fun convert(baseViewHolder: BaseViewHolder, bean: String) {
                val statusBar = UltimateBarX.getStatusBar(activity as FragmentActivity)
                val view = baseViewHolder.getView<TextView>(R.id.tv_item_main)
                view.text = bean
                baseViewHolder.itemView.setClick {
                    val p = baseViewHolder.adapterPosition
                    if (p == 0) {
                        statusBar.fitWindow(false).apply()
                    } else if (p == 1) {
                        statusBar.fitWindow(true).apply()
                    } else if (p == 2) {
                        statusBar.light(true).apply()
                    } else if (p == 3) {
                        statusBar.light(false).apply()
                    } else if (p == 4) {
                        statusBar.color(Color.RED).apply()
                    } else if (p == 5) {
                        statusBar.drawableRes(R.drawable.aa).apply()
                    } else if (p == 6) {
                        ImmersionBar.with(activity).transparentStatusBar().init()
                    } else if (p == 7) {
                        ImmersionBar.with(activity).statusBarDarkFont(true).init()
                    } else if (p == 8) {
                        ImmersionBar.with(activity).statusBarDarkFont(false).init()
                    }
                }
            }
        }
    }

    override fun getList(page: Int) {}
    override fun getMore(page: Int) {}
}